<template>
    <div class="realMan">
        <div class="realMan_header">
            <van-nav-bar title="实名认证" left-text="返回" left-arrow @click-left="realManonClickLeft"/>
        </div>
        <div class="realMan_text">请上传身份证正反面照</div>
        <div class="realMan_imgs">
            <van-uploader v-model="fileList" multiple :max-count="2" />
        </div>
        <div class="realMan_button">
            <van-button type="primary" block round color="#1E5EAE" @click="upload">上 传</van-button>
        </div>
    </div>
</template>
<script>
import { mapActions } from 'vuex'
import { Toast } from 'vant';
export default {
    data(){
        return{
            fileList: [],
        }
    },
    methods:{
        ...mapActions('user',['uploadUser']),
        realManonClickLeft(){
            this.$router.push({path:'user'})
        },
        upload(){
            if(this.fileList.length==2){
                this.uploadUser(localStorage.getItem('id'))
                Toast('上传成功！');
                this.fileList=[];
                this.$router.push({path:'user'})
            }else{
                Toast('请上传两张照片！');
            }
            
        }
    }
}
</script>
<style scope>
    .realMan_text{
        width:100%;
        text-align:center;
        height:50px;
        line-height:50px;
        border-bottom:1px solid #ddd;
        background-color: #eee;
    }
    .realMan_imgs{
        margin:10px;
    }
    .realMan_button{
        margin:5px 50px 0 50px;
    }
</style>